A conventional programmable controller offers an on-line module changing function, which is initiated by the user during the on-line mode when an input/output module connected with an external device becomes faulty. During this changing function, the controller does not switch to an off-line mode, but instead allows only the faulty module to be changed.
FIG. 10 illustrates the system configuration of a conventional programmable controller which offers the above noted on-line module changing function. As shown in FIG. 10, the system includes a CPU 1, an input module 2, an output module 3, a base unit 4 and an external device 5. The CPU module 1 controls input/output signals from/to the input module 2 or the output module 3. The input module 2 inputs signals from the external device 5, and the output module 3 outputs signals to the external device 5. Hereinafter, modules 2 and 3 will be collectively referred to as the I/O modules.
The base unit 4 (hereinafter the "base") electrically connects the CPU module 1 and the I/O modules. The external device 5, which is connected to the I/O modules, serves as an object to be controlled, and may be, for example, a machining tool. The conventional system also includes a peripheral device 5A, which allows the user to create and transfer sequential programs to the CPU module 1. These programs identify and control the execution of sequential processing of the external device 5. The peripheral device 5A also allows the user to forcibly change a device's state (e.g., to assign input information X, output information Y and data information D) in the CPU module 1. The peripheral device 5A also allows a user to perform wiring checks and sequence program debugging. Thus, when a user wishes to change an I/O module while in the on-line mode, the user must use the peripheral device 5A to enter module changing information, including the identification of which I/O module the user intends to replace, as will be explained in more detail below.
FIG. 11 represents a block diagram illustrating a more detailed arrangement of the CPU module 1 and the I/O modules 2 and 3 in the conventional programmable controller of FIG. 10. The CPU 6 executes a sequence program and controls sequential processing of the external device 5. A module information table 7 contains information uniquely identifying each module. An input port 10 reads input signals transmitted from the input module 2 and transfers these signals onto a common bus. An input device memory 8 stores input signals transmitted from the input module 2 via the input port 10 as information. A save memory 9 temporarily saves the information stored in the input device memory 8.
An output device memory 11 stores output signals as information and an output port 12 transmits the output signals to the output module 3. Switches 13 and 14 enable and disable access to the input module 2 and the output module 3, respectively.
A ROM 19 stores the operating system that controls the operation of the CPU 6 and a working RAM 20. As shown in FIG. 11, the RAM 20 which includes the module information table 7 and the save memory 9, provides information to the CPU 6 during sequential processing. Device memory 21 includes the input device memory 8 and output device memory 11, and temporarily stores the most recent information read to and written from each input and output module while a module is being changed. The sequence program memory 22 stores the sequence programs written by the user which control the sequential processing.
FIG. 12 illustrates an exemplary sequence program entered by the user (via peripheral device 5A) to initiate a module changing function and to indicate which I/O module is to be replaced. The user enters this sequence during the on-line mode. Numeral 50 represents an input condition "X" and numeral 51 represents a transfer instruction "MOVP". A transfer data function (at point 52) identifies the specified number of a module to be changed. In this example, the value "H0005" represents a numerical value of 5. A predetermined word device 53 (illustrated by "D9094" in FIG. 12), that is concerned with the on-line module change, represents the transfer destination of the transfer data 52. A predetermined bit device 54 is represented by "M9094".
Thus, when a user intends to change a module, the user enters, via the peripheral device 5A, the transfer instruction 51, the number of the module to be replaced 52, the destination of the transfer data 53 and the bit device 54. Thereafter, the user turns ON the input condition 50 and the peripheral device 5A transmits the sequential program (FIG. 12) to the CPU 1.
FIG. 13 illustrates an on-line I/O module replacement processing flowchart for the programmable controller shown in FIG. 10. The on-line module changing procedure for the controller of FIG. 10 is described with references to FIGS. 11-12. In operation, the user initially writes the sequence program (FIG. 12) by using the peripheral device 5A, transfers the program to the CPU module 1, and causes the CPU module 1 to execute the sequence program by switching ON the input condition "X" 50. When the input condition "X" 50 is switched ON, the sequence program causes the specified module number to be stored in the predetermined word device.
In the example of FIG. 12, the module number "5" is stored in word device "D9094", thereby identifying the module to be changed. Next, the sequence program switches ON the predetermined bit device "M9094" 54. This causes the CPU module 1 to stop communicating with the I/O module 2 or 3, which corresponds to the number specified in the predetermined word device "D9094" 53, thereby allowing the corresponding I/O module to be changed. The user then removes the I/O module and installs a new I/O module 2 or 3 in the base 4. Once the user checks to ensure that the module has been completely installed, the user switches OFF the input condition "X" 50. Thereafter, the predetermined bit device "M9094" 54 is switched OFF and the CPU module 1 resumes normal control of new, i.e., changed I/O module 2 or 3.
As an alternative procedure, by employing the device forced-change function of the peripheral device 5A, the user may change the content of the predetermined word device "D9094" 53 into the specified number of the I/O module 2 or 3 and switches ON the predetermined bit device "M9094" 54. This causes the CPU module 1 to stop control of the I/O module 2 or 3 corresponding to the specified number, thereby allowing the corresponding module to be changed. Once the module has been changed, and the user switches OFF the predetermined bit device "M9094" 54, the CPU module 1 resumes normal control of the new I/O module 2 or 3.
Processing carried out for unit replacement in the CPU module 1 will now be described. In the on-line mode, the CPU 6 repeats sequence processing and programmable controller processing, other than sequence processing. The programmable controller processing is also referred to as end processing. The sequence processing represents processing carried out by the CPU 6 while under the control of the sequence program in the sequence program memory 9. During sequence processing, the contents of the input device memory 8 are monitored by the CPU 6 as necessary input information, and output information is stored in the output device memory 11.
End processing represents the processing segment during which the contents of the input port 10 and the input device memory 8 are ORed together. The results of this ORing operation are stored in the input device memory 8, in order to retain the contents of the input port 10 in the input device memory 8. The contents of the output device memory 11 are output to the output port 12.
End processing includes the processing segment, during which the CPU module 1 ceases communication with the I/O module 2 or 3 identified for replacement, in order to render it changeable. The flowchart shown in FIG. 13 is divided into left-hand side and right-hand side processing sequences. The left-hand side processing sequence includes steps S121-S125 and S130, and operates to stop communication with the I/O module 2 or 3 in order to make it changeable. The right-hand side processing sequence includes steps S126-S129 and operates to resume communication with the I/O module 2 or 3.
Processing is started in step S120, and in step S121 it is determined whether the predetermined bit device is ON or OFF. If it is ON, the prewritten module information table 7 is checked in step S122 to determine whether the module specified in the predetermined word device corresponds to the input or output module. If the specified module is the output module, then the program jumps to step S125, where the access enable switch 14 is opened. If the specified module is the input module, then the contents of the input device memory 8 are saved in the save memory 9 in step S123.
This saving operation ensures that once the module has been changed, the contents of the input device port may be restored to the contents before the change. If the specified module is the input module, the information of the real input port 10 and the contents of the input device memory 8 are ORed to reflect the information of the real input port 10 on the input device memory 8 and the results are stored into the input device memory 8 in step S124. The access enable switch 13 is opened in the step S125, and the processing is terminated in step 130.
When the access enable switch 13 or 14 is opened, I/O signals from/to the corresponding module are made invalid, and control is stopped. In the sequence processing of the CPU module 1, the states of the I/O devices thereof corresponding to the I/O modules 2 and 3 are processed by using only the information stored in the input device memory 8, and not by using the information of the input signals from the module. Output information is processed by employing only the information stored in the output device memory 11, and not by providing output signals to the module.
Once the module change has been made and it is determined in step S121 that the predetermined bit device is OFF, the specified access enable switch 13 or 14 is closed in step S126. Thereafter it is determined whether the corresponding module is the input module or the output module in step S127. If it is the input module, then the contents of the input device memory 8 saved in the save memory 9 are restored to the input device memory 8 in step S128. If it is the output module, then the contents of the output device memory 11 are output to the output port 12 in step S129, and the processing is terminated in step S130.
The programmable controller as configured above necessitates the use of the peripheral device 5A to change the predetermined device when I/O module replacement is made during the on-line mode. Further the user must know the specified I/O module number and the predetermined device word and device bit addresses before the user can initiate a replacement operation. These attendant limitations of the conventional system unduly complicate operation and increase the potential for error. In addition, the user is unable to determine when the I/O module has entered a changeable state and thus, the user may become anxious and/or doubtful about the I/O module replacement.